using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using Entity.StoredProcedure;
namespace BusinessObjects.BO_GetObjects {
    public static class BO_portal_articles {
        public static DataTable SelectAll(int status) {
            try {
                usp_portal_articles_select_all entity = new usp_portal_articles_select_all();
                entity.STATUS = status;
                return BO_Actions<usp_portal_articles_select_all>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectAllArt(int status)
        {
            try
            {
                usp_portal_articles_art_select_all entity = new usp_portal_articles_art_select_all();
                entity.STATUS = status;
                return BO_Actions<usp_portal_articles_art_select_all>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SelectTop(int rows, int status) {
            try {
                usp_portal_articles_select_top entity = new usp_portal_articles_select_top();
                entity.NUMBERRECORD = rows;
                entity.STATUS = status;
                return BO_Actions<usp_portal_articles_select_top>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable Search(int article_id) {
            try {
                usp_portal_articles_search entity = new usp_portal_articles_search();
                entity.ARTICLE_ID = article_id;
                return BO_Actions<usp_portal_articles_search>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectWithPaged(int startIndex, int pageCount, int status) {
            try {
                usp_portal_articles_select_paged_width_cid entity = new usp_portal_articles_select_paged_width_cid();
               
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return BO_Actions<usp_portal_articles_select_paged_width_cid>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectWithPagedWidthCid(int startIndex,int cid, int pageCount, int status)
        {
            try
            {
                usp_portal_articles_select_paged_width_cid entity = new usp_portal_articles_select_paged_width_cid();
                entity.CATEGORY_ID = cid;
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                return BO_Actions<usp_portal_articles_select_paged_width_cid>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(int category_id, int article_type, string article_code, string mutil_thumb_img, string thumb_img, string short_article_title, string short_article_title_eng, string full_article_title, string full_article_title_eng, string short_article_description, string short_article_description_eng, string full_article_description, string full_article_description_eng, string article_detail, string article_detail_eng, string meta_keyword, string meta_description, string tags, int total_download, int total_vote, int total_comment, int total_view, bool is_display_on_home_page, bool is_hot, int order_display, int order_display_in_category, DateTime published_date, DateTime approved_date, string approved_by, DateTime created_date, string created_by, DateTime modify_date, string modify_by, int status) {
            try {
                usp_portal_articles_insert entity = new usp_portal_articles_insert();
                entity.CATEGORY_ID = category_id;
                entity.ARTICLE_TYPE = article_type;
                entity.ARTICLE_CODE = article_code;
                entity.MUTIL_THUMB_IMG = mutil_thumb_img;
                entity.THUMB_IMG = thumb_img;
                entity.SHORT_ARTICLE_TITLE = short_article_title;
                entity.SHORT_ARTICLE_TITLE_ENG = short_article_title_eng;
                entity.FULL_ARTICLE_TITLE = full_article_title;
                entity.FULL_ARTICLE_TITLE_ENG = full_article_title_eng;
                entity.SHORT_ARTICLE_DESCRIPTION = short_article_description;
                entity.SHORT_ARTICLE_DESCRIPTION_ENG = short_article_description_eng;
                entity.FULL_ARTICLE_DESCRIPTION = full_article_description;
                entity.FULL_ARTICLE_DESCRIPTION_ENG = full_article_description_eng;
                entity.ARTICLE_DETAIL = article_detail;
                entity.ARTICLE_DETAIL_ENG = article_detail_eng;
                entity.META_KEYWORD = meta_keyword;
                entity.META_DESCRIPTION = meta_description;
                entity.TAGS = tags;
                entity.TOTAL_DOWNLOAD = total_download;
                entity.TOTAL_VOTE = total_vote;
                entity.TOTAL_COMMENT = total_comment;
                entity.TOTAL_VIEW = total_view;
                entity.IS_DISPLAY_ON_HOME_PAGE = is_display_on_home_page;
                entity.IS_HOT = is_hot;
                entity.ORDER_DISPLAY = order_display;
                entity.ORDER_DISPLAY_IN_CATEGORY = order_display_in_category;
                entity.PUBLISHED_DATE = published_date;
                entity.APPROVED_DATE = approved_date;
                entity.APPROVED_BY = approved_by;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;

                return BO_Actions<usp_portal_articles_insert>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static string Update(int article_id,string thumb_img,string full_article_description,DateTime modify_date, string modify_by, int status,int order_display) {
            try {
                usp_portal_articles_update entity = new usp_portal_articles_update();
                entity.ARTICLE_ID = article_id;
                entity.THUMB_IMG = thumb_img;
                entity.FULL_ARTICLE_DESCRIPTION = full_article_description;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.ORDER_DISPLAY = order_display;
                entity.STATUS = status;
                return BO_Actions<usp_portal_articles_update>.ExecuteAndReturnStringValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Delete(string ids, string spliter, int delete_type) {
            try {
                usp_portal_articles_delete entity = new usp_portal_articles_delete();
                entity.IDS = ids;
                entity.SPLITER = spliter;
                entity.DELETE_TYPE = delete_type;
                return BO_Actions<usp_portal_articles_delete>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static bool Restore(int article_id) {
            try {
                usp_portal_articles_restore entity = new usp_portal_articles_restore();
                entity.ARTICLE_ID = article_id;

                return BO_Actions<usp_portal_articles_restore>.ExecuteAndReturnBooleanValue(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable SelectAdmin(int category_id, string keyword, int startIndex, int pageCount, int status) {
            try {
                usp_portal_articles_select_admin entity = new usp_portal_articles_select_admin();
                entity.STARTINDEX = startIndex;
                entity.MAXRECORDS = pageCount;
                entity.STATUS = status;
                entity.CATEGORY_ID = category_id;
                entity.KEYWORDS = keyword;
                return BO_Actions<usp_portal_articles_select_admin>.ExecuteAndReturnDataTable(entity);
            } catch (Exception ex) {
                throw ex;
            }
        }
        public static DataTable Search(string full_article_title, int maxrecord)
        {
            try
            {
                usp_portal_articles_search_by_title entity = new usp_portal_articles_search_by_title();
                entity.FULL_ARTICLE_TITLE = full_article_title;
                entity.MAXRECORDS = maxrecord;
                return BO_Actions<usp_portal_articles_search_by_title>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        //add new gallery
        public static DataTable Get_All_Gallery()
        {
            try
            {
                usp_portal_articles_art_Get_All_Gallery entity = new usp_portal_articles_art_Get_All_Gallery();
                return BO_Actions<usp_portal_articles_art_Get_All_Gallery>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        //insert gallery
        public static string Insert_Gallery(int category_id, string thumb_img, string full_article_description, string full_article_description_eng, DateTime create_date)
        {
            try
            {
                usp_portal_articles_art_Add_New_Gallery entity = new usp_portal_articles_art_Add_New_Gallery();
                entity.CATEGORY_ID = category_id;
                entity.CREATED_DATE = create_date;
                entity.FULL_ARTICLE_DESCRIPTION = full_article_description;
                entity.FULL_ARTICLE_DESCRIPTION_ENG = full_article_description_eng;
                entity.THUMB_IMG = thumb_img;
                return BO_Actions<usp_portal_articles_art_Add_New_Gallery>.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                
                throw ex;
            }
        }
        //get type gallery
        public static DataTable Get_Type_Gallery()
        {
            try
            {
                usp_portal_articles_art_Get_Type_Gallery entity = new usp_portal_articles_art_Get_Type_Gallery();
                return BO_Actions<usp_portal_articles_art_Get_Type_Gallery>.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        //
        public static string Update_Gallery(int articles_id, string thumps, string full_article_description, string full_article_description_eng)
        {
            try
            {
                usp_portal_articles_update_gallery entity = new usp_portal_articles_update_gallery();
                entity.ARTICLE_ID = articles_id;
                entity.FULL_ARTICLE_DESCRIPTION = full_article_description;
                entity.FULL_ARTICLE_DESCRIPTION_ENG = full_article_description_eng;
                entity.THUMB_IMG = thumps;
                return BO_Actions<usp_portal_articles_update_gallery>.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        //LOAD MENU
        public static DataTable LoadMenuDong()
        {
            try
            {
                usp_portal_articles_art_Load_Menu menu = new usp_portal_articles_art_Load_Menu();
                return BO_Actions<usp_portal_articles_art_Load_Menu>.ExecuteAndReturnDataTable(menu);
            }
            catch (Exception)
            {
                
                throw;
            }
        }
    }
}

